package com.atguigu.distributed.lock.leecode;

public enum CountryEnum {
    One(1,"齐"),TWO(2,"楚"),THREE(3,"燕"),FOUR(4,"赵"),FIVE(5,"魏"),SIX(6,"韩");
    private Integer code;
    private String message;

    CountryEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    public static CountryEnum getCountryName(Integer index){
        CountryEnum[] values = CountryEnum.values();
        for (int i = 0; i < values.length; i++) {
            CountryEnum value = values[i];
            if(value.getCode().equals(index)){
                return value;
            }
        }
        return null;
    }
}
